﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="main_Register" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>用户注册</title>
    <style type="text/css">
        /* 现代渐变背景 */
        body {
            font-family: 'Segoe UI', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* 注册卡片 */
        .register-container {
            background: white;
            border-radius: 15px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
            width: 400px;
            padding: 40px;
            animation: fadeIn 0.5s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* 标题样式 */
        h2 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 30px;
            font-weight: 600;
            position: relative;
        }

        h2:after {
            content: "";
            display: block;
            width: 50px;
            height: 3px;
            background: linear-gradient(to right, #667eea, #764ba2);
            margin: 10px auto 0;
        }

        /* 输入框组 */
        .input-group {
            margin-bottom: 25px;
            position: relative;
        }

        .input-label {
            display: block;
            margin-bottom: 8px;
            color: #7f8c8d;
            font-size: 14px;
            font-weight: 500;
        }

        .form-input {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s;
            box-sizing: border-box;
            background: #f9f9f9;
        }

        .form-input:focus {
            border-color: #667eea;
            background: white;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
            outline: none;
        }

        /* 按钮样式 */
        .register-btn {
            background: linear-gradient(to right, #667eea, #764ba2);
            color: white;
            border: none;
            padding: 14px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            width: 100%;
            transition: all 0.3s;
            margin-top: 10px;
        }

        .register-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        /* 登录链接 */
        .login-link {
            display: block;
            text-align: center;
            margin-top: 20px;
            color: #667eea;
            text-decoration: none;
            font-size: 14px;
            transition: color 0.3s;
        }

        .login-link:hover {
            color: #764ba2;
            text-decoration: underline;
        }

        /* 错误提示 */
        .error-message {
            color: #e74c3c;
            font-size: 13px;
            text-align: center;
            margin-top: 15px;
            padding: 10px;
            border-radius: 5px;
            background: rgba(231, 76, 60, 0.1);
        }

        /* 验证器样式 */
        .validator-error {
            color: #e74c3c;
            font-size: 12px;
            display: block;
            margin-top: 5px;
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .register-container {
                width: 90%;
                padding: 30px;
            }
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div class="register-container">
            <h2>用户注册</h2>
            
            <div class="input-group">
                <asp:Label ID="lblUsername" runat="server" Text="用户名" CssClass="input-label"></asp:Label>
                <asp:TextBox ID="txtUsername" runat="server" CssClass="form-input" placeholder="请输入用户名"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvUsername" runat="server" 
                    ControlToValidate="txtUsername" ErrorMessage="用户名不能为空" 
                    CssClass="validator-error" Display="Dynamic"></asp:RequiredFieldValidator>
            </div>
            
            <div class="input-group">
                <asp:Label ID="lblPassword" runat="server" Text="密码" CssClass="input-label"></asp:Label>
                <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" 
                    CssClass="form-input" placeholder="请输入密码"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvPassword" runat="server" 
                    ControlToValidate="txtPassword" ErrorMessage="密码不能为空" 
                    CssClass="validator-error" Display="Dynamic"></asp:RequiredFieldValidator>
            </div>
            
            <asp:Button ID="btnRegister" runat="server" Text="注册" CssClass="register-btn" OnClick="btnRegister_Click" />
            
            <asp:HyperLink ID="hlLogin" runat="server" NavigateUrl="~/main/Login.aspx" 
                CssClass="login-link">已有账号？立即登录</asp:HyperLink>
            
            <asp:Label ID="lblMessage" runat="server" CssClass="error-message"></asp:Label>
        </div>
    </form>
</body>
</html>